/*
 * @Author: 高瑞寒 15932717091@163.com
 * @Date: 2022-04-29 23:49:10
 * @LastEditTime: 2022-04-30 14:55:54
 * @LastEditors: 高瑞寒 15932717091@163.com
 * @Description: 
 */
import React, { Component } from 'react'
// import qs from 'querystringify'

export default class Detail extends Component {
  state = {
    list: [
      { id: '01', content: '你好', },
      { id: '02', content: '我好', },
      { id: '03', content: '大家好', },
    ]
  }
  render() {
    // param 参数解析
    // const {id,title} = this.props.match.params
    // query 参数解析
    // const { id, title } = qs.parse(this.props.location.search)
    // state 参数解析
    const { id, title } = this.props.location.state || {}

    return (
      <ul>
        <li>ID:{id}</li>
        <li>TITLE:{title}</li>
        <li>CONTENT:{this.state.list.find(item => item.id === id)?.content}</li>
      </ul>
    )
  }
}

